﻿@model ViewModelResult
@{
    var _forum = Model.Forum;

    var _topic = Model.Topic;
    
    var _isMod = Model.IsMod;
}
@if (_forum != null || _topic != null || !string.IsNullOrWhiteSpace(Model.PageRender))
{
    
    
    <div class="white-bt">
        @Html.Raw(Model.PageRender)
        @if (_topic != null)
        {

            if (!ForumContext.Logined || ForumContext.AllowAccess(CommandType.NewPost, _forum, null))
            {
            @Html.Link(string.Format("{0}?Id={1}", ForumContext.GetAbsoluteUrl(ForumUrls.POST), _topic.ForumId), ForumContext.GetText(LanguageSection.TOPICS, "NEW_POST"), new { @class = "ui-button large icon-24 new-post" })        
            }

            if (ForumContext.AllowAccess(CommandType.NewPoll, _forum, null))
            {
            @Html.Link(string.Format("{0}?Id={1}", ForumContext.GetAbsoluteUrl(ForumUrls.NEW_POLL), _topic.ForumId), ForumContext.GetText(LanguageSection.TOPICS, "NEW_POLL"), new { @class = "ui-button large icon-24 new-poll" })        
            }

            if (!ForumContext.Logined || ForumContext.AllowAccess(CommandType.Reply, _forum, _topic))
            {
            @Html.Link(string.Format("{0}?Id={1}", ForumContext.GetAbsoluteUrl(ForumUrls.NEW_REPLY), _topic.TopicId), ForumContext.GetText(LanguageSection.TOPICS, "Reply"), new { @class = "ui-button large icon-24 reply" })        
            }
            

            if (ForumContext.IsSuperMod || _isMod)
            {
            @(_topic.IsLocked ? Html.Link(string.Format("{0}?Id={1}&act={2}", ForumContext.GetAbsoluteUrl(ForumUrls.COMMAND), _topic.TopicId, (int)CommandType.UnLockTopic), ForumContext.GetText(LanguageSection.TOPICS, "UN_LOCK"), new { @class = "ui-button large icon-24 un-lock" }) : Html.Link(string.Format("{0}?Id={1}&act={2}", ForumContext.GetAbsoluteUrl(ForumUrls.COMMAND), _topic.TopicId, (int)CommandType.LockTopic), ForumContext.GetText(LanguageSection.TOPICS, "LOCK"), new { @class = "ui-button large icon-24 lock" }))
            }

        }
        else if (_forum != null)
        {

            if (!ForumContext.Logined || ForumContext.AllowAccess(CommandType.NewPost, _forum, null))
            {
            @Html.Link(string.Format("{0}?Id={1}", ForumContext.GetAbsoluteUrl(ForumUrls.POST), _forum.ForumId), ForumContext.GetText(LanguageSection.TOPICS, "NEW_POST"), new { @class = "ui-button large icon-24 new-post" })        
            }

            if (ForumContext.AllowAccess(CommandType.NewPoll, _forum, null))
            {
          
            @Html.Link(string.Format("{0}?Id={1}", ForumContext.GetAbsoluteUrl(ForumUrls.NEW_POLL), _forum.ForumId), ForumContext.GetText(LanguageSection.TOPICS, "NEW_POLL"), new { @class = "ui-button large icon-24 new-poll" })    
           
            }
            if (ForumContext.IsAdmin)
            {
            @(_forum.IsLocked ? Html.Link(string.Format("{0}?Id={1}&act={2}", ForumContext.GetAbsoluteUrl(ForumUrls.COMMAND), _forum.ForumId, (int)CommandType.UnLockForum), ForumContext.GetText(LanguageSection.FORUM, "UN_LOCK"), new { @class = "ui-button large icon-24 un-lock" }) : Html.Link(string.Format("{0}?Id={1}&act={2}", ForumContext.GetAbsoluteUrl(ForumUrls.COMMAND), _forum.ForumId, (int)CommandType.LockForum), ForumContext.GetText(LanguageSection.FORUM, "LOCK"), new { @class = "ui-button large icon-24 lock" }))
            }
        }
        <br class="empty" />
    </div>
}
